home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-04-21 | 1.6 KB | 43 lines | [TEXT/GEOL] |
- Item 1461510 20-April-89 10:56
-
- From: ALGER Alger, Jeff
-
- To: BIANCHI1 Bianchi, Curt
- ROLLIN1 Rollin, Keith A.
- D2215 Dac SW, Wilma Blair, PRT
-
- cc: MACAPP.TECH$ MACAPP Tech
-
- Sub: Re- Segmentation Changes?
-
- Curt, Keith, and Les,
-
- Curt, as usual your observations are right on, this time regarding passing >4
- byte instance variables when a heap shuffle may occur. However, I have a
- historical question: why does the Pascal compiler not simply copy such
- arguments onto the stack before the call? Consider the following code
- fragment, where fMyInstanceVariable is > 4 bytes:
-
- someOtherObject.SomeMethod (SELF.fMyInstanceVariable);
-
- This is normally an unstable call, but the compiler could easily have detected
- this (it issues an error message now) and copied fMyInstanceVariable onto the
- stack as a default behavior. This avoids code like the following, which is
- identical in effect and efficiency, since local variables are also on the
- stack:
-
- myLocal := fMyInstanceVariable;
- someOtherObject.SomeMethod (myLocal);
-
- The code of the former is cleaner and does not force the coder to worry about
- how many bytes the compiler may choose to use in representing data types; after
- all, isn't this one of the advantages of a high-level language? A compiler
- option could warn of such automatic copying and another could turn off the
- behavior in situations where you are sure that the call is safe.
-
- I would be interested to hear any thoughts on the subject.
-
- Jeff Alger
-
-
-